/* File name     :  nfivi_io.h
 * Author        :  Wentao Shang
 * 
 * Contents      :
 *    This file is the header file for the 'nfivi_io.c' file,
 *    which contains all the system header files and definitions
 *    used in the 'nfivi_io.c' file.
 *
 */

#ifndef NFIVI_IO_H
#define NFIVI_IO_H

#include <linux/module.h>

#include <asm/uaccess.h>
#include <asm-generic/errno-base.h>
#include <linux/fs.h>
#include <linux/ioctl.h>

#include "nfivi_map.h"

/* device information */
#define MAJOR_NUM                     324
#define DEVICE_NAME                   "nfivi"

#define DEVICE_FILE_NAME              "/dev/nfivi"

/* ioctl operation commands */
#define IOCTL_SET_MOD                 _IOW(MAJOR_NUM, 0, int)
#define IOCTL_GET_MOD                 _IOR(MAJOR_NUM, 1, int)
#define IOCTL_SET_RES                 _IOW(MAJOR_NUM, 2, int)
#define IOCTL_GET_RES                 _IOR(MAJOR_NUM, 3, int)
#define IOCTL_SET_AUTOCONFIG          _IO(MAJOR_NUM, 4)
#define IOCTL_UNSET_AUTOCONFIG        _IO(MAJOR_NUM, 5)
#define IOCTL_SET_TIMEOUT             _IOW(MAJOR_NUM, 6, long)
#define IOCTL_GET_TIMEOUT             _IOR(MAJOR_NUM, 7, long)

/* ioctl error numbers */
#define EINPUT_TOO_LARGE              1001

/* hook functions for nfivi */
extern int device_open(struct inode *inode, struct file *file);
extern int device_release(struct inode *inode, struct file *file);
extern int device_ioctl(struct inode *inode, struct file *file, unsigned int ioctl_num, unsigned long ioctl_param);

#endif

